﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace MyAnimelistRecommender.Converter
{
    public class SortingStateToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string svalue = (parameter as string);
            if (svalue == "votes" && App.Model.SelectedSortingMode == "Recommends")
                return Colors.Black;
            else if (svalue == "calced" && App.Model.SelectedSortingMode == "Scored Recommends")
                return Colors.Black;
            else if (svalue == "sources" && App.Model.SelectedSortingMode == "Sources")
                return Colors.Black;
            else return SelectedColor;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        public Brush SelectedColor { get; set; }
    }
}